package com.example.locationtracking.utils;

import android.app.Activity;
import android.content.Context;
import android.net.ConnectivityManager;
import android.util.DisplayMetrics;

public class DeviceInfo {
	public static int ScreenDensity = 0;
	public static int ScreenWidth = 0;
	public static int ScreenHeight = 0;
	public static void setup(Activity context){
		DisplayMetrics metrics = new DisplayMetrics();    
		context.getWindowManager().getDefaultDisplay().getMetrics(metrics);    
		ScreenDensity = metrics.densityDpi;
		ScreenWidth = metrics.widthPixels;
		ScreenHeight = metrics.heightPixels;
	}
	public static boolean checkNetworkState(Context context){
		 return ((ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE)).getActiveNetworkInfo() != null;
	}
	public static int convertDPIToPixel(int dp){
		return dp*ScreenDensity/160;
	}
	
}
